import {defineStore} from "pinia";
import {UserState} from "@/interface";
import piniaPersistConfig from "@/stores/helper/persist";

export const useUserStore = defineStore('owl-admin-user', {
  state: (): UserState => ({
    token: "",
    userInfo: {name: "Owl"}
  }),
  getters: {},
  actions: {
    // Set Token
    setToken(token: string) {
      this.token = token;
    },
    // Set setUserInfo
    setUserInfo(userInfo: UserState["userInfo"]) {
      this.userInfo = userInfo;
    }
  },
  persist: piniaPersistConfig("owl-user")
});
